#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "BmpShow.h"
#include "DoubleList.h"



#define MENU_PIC    "./RSC/menu.bmp"

extern DNodep Headp;
extern DNodep Tempp;
extern int film_flag;


/**
 @function: show every pic in the pic's dir, per pic delay 3s.
 @params: the bmpPic's doublelist's head pointer
 @ret: NULL
*/
void *FilmShow_Thread(void *arg)
{
//    DNodep Tempp = (DNodep)arg;
#if 0
    if(arg == NULL)
    {
        perror("FilmShow Thread arg invalid!");
        exit(-1);
    }
#endif

	for(;;)
	{
		if(film_flag == 1)
        {
            if(Tempp == Headp)
            {
                Tempp = Tempp->next; //skip the Headp
                //Tempp = Tempp->prev;
            }
            printf("%s\n", Tempp->data);
		    lcd_showbmp_api(Tempp->data, 0, 0,1);
            lcd_showbmp_api(MENU_PIC, 730, 0,0);
		    sleep(3);

           Tempp = Tempp->next;
           //Tempp = Tempp->prev;
	    }
    }
    return NULL;
}

